package configuration

import (
	"encoding/json"
	"fmt"
	"kop/modules/configuration/client"
	"kop/util/log"
)

var DailyQuestConfigs []DailyQuestConf

type DailyQuestConf struct {
	ID         int32 // 索引ID
	GuildMoney int32 // 参数1
	AwardID    int32 // 奖励ID
}

func init() {

	var err error
	if err = json.Unmarshal(client.Load("GuildBuild"), &DailyQuestConfigs); err != nil {
		panic(err)
	}

	log.Info("Load GuildBuild.json success.")
}

func GetMission(ID int32) DailyQuestConf {

	for _, v := range DailyQuestConfigs {
		if v.ID == ID {
			return v
		}
	}

	panic(fmt.Errorf("GuildDailyQuestConf not found [%d]", ID))
}
